<?php


namespace App\Extensions\Actions\Document;

use App\Extensions\Action;
use App\Services\DocumentService;

class CacheStaticFileToLocalPost extends Action
{
    protected $selector = '.cache-upload';
    public $name = '缓存文件';

    public function handle()
    {
        DocumentService::getInstance()->cacheStaticFileToLocal();
        return $this->response()->success('操作成功')->refresh();
    }

    public function dialog()
    {
        $this->confirm('确定要缓存到本地吗');
    }

    public function html()
    {
        return <<<HTML
        <a class="btn btn-sm btn-default cache-upload">{$this->name()}</a>
HTML;
    }
}
